package com.learn.life;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class BeanLifeCycle {

    public static void main(String[] args) {
        System.out.println("现在开始初始化容器");
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig.class);
        Object person = applicationContext.getBean("person");
        Object person1 = applicationContext.getBean("person1");
        System.out.println("person1==person:" + (person1==person));
        System.out.println("容器初始化成功");
        ((AnnotationConfigApplicationContext)applicationContext).registerShutdownHook();
    }
}
